package sustOJ;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author : niu niu
 * @version : 1.0.0
 * @date : 2022/10/13 6:53
 */
public class WordAnys {
    static int[] count = new int[26];
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        int max = 0;
        for (int i = 0; i < str.length(); i++) {
            count[str.charAt(i) - 'a'] ++;
        }
        for (int i = 1; i < count.length; i++) {
            if(count[i-1]>count[max]){
                max= i-1;
            }
        }
        int ret = max+'a';
        System.out.println((char) ret);
        System.out.println(count[max]);
    }
}
